import { createApp } from "vue";
import Antd from "ant-design-vue";
import { message } from "ant-design-vue";
import "ant-design-vue/dist/antd.less";
import "./style/index.less";
import "./assets/fontIcon/iconfont.css";
import router from "./router/index";
import "./router/rolePermission";
import App from "./App.vue";
import { setupStore } from "~/store";
import VCalendar from "v-calendar";
import "v-calendar/dist/style.css";

import dayjs from "dayjs";
import "dayjs/locale/zh-cn";
dayjs.locale("zh-cn");

message.config({
	maxCount: 1,
});

const app = createApp(App);

function setupApp() {
	globalThis.logger = {
		string(...logs) {
			console.log(...logs);
		},
		json(jsonObject: Dict<any>) {
			console.log(JSON.stringify(jsonObject, null, 4));
		},
		tag(t: string, ...args) {
			console.log(t, ...args);
		},
	};

	globalThis.buildTime = (times: any) => {
		const r = dayjs(times).format("YYYY-MM-DD HH:mm:ss");
		console.log(r);
		return r;
	};

	// 挂载vuex状态管理
	setupStore(app);
	// permission(app);
	app.use(Antd);

	app.use(router);
	app.use(VCalendar, {});
	// app.use(L);
	// app.directive
	app.mount("#app");
}
setupApp();
